//复用代码
//封装跳转代码

import { useNavigate } from "react-router-dom"


function useToNavigate(){
    const navigate= useNavigate()
        const handleMenuClick=(rout,hande) =>{
            console.log("菜单被点击了",hande)
            const path=hande+rout.key
            console.log(path)
            navigate(path)
            // window.location.reload();
            // navigate(`/${hande}${path}`)
        }
        return {
            handleMenuClick
        }    
}

export {useToNavigate}